<style>
    .item-wrap {overflow:hidden;padding:2%;}
    .set-item {float:left;width:25%;padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid #eeeeee;}
    .goods-pic {overflow:hidden;margin-bottom:20px;}
    .goods-pic .des{float: left;margin-right:15px;margin-top:23px;color:#666;}
    .goods-pic .image-input{float:left;margin-right:10px;}
    .goods-pic p {float:left;color:#999999;margin-top:13px;text-align:center;}
    .set-item label{display:inline-block;width:33%;text-align:left;color:#666666;float: left;white-space: nowrap;overflow: hidden;}
    .wxapps-cat,.wxapps-tag {margin:5px 0;}
    .select-cont select,.goods-des input {width:60%;border:1px solid #dddddd;border-radius:0;padding:3px 5px;height:25px;line-height:18px;background:white;-webkit-appearance: none;}
    .goods-des input {height:21px;}
    .sel {position:relative;}
    .sel:after {position:absolute;right:10%;top:10px;content:'';border:5px solid #999999;border-color:#999999 transparent transparent transparent;}
</style>
<form action="index.php?app=wxapi&ctl=admin_navigator&act=apple" method="post" class="tableform" id="form_member_lv">
    <div class="item-wrap">
            <{assign var="navIdxArr" value=array(0,1,2,3,4,5,6,7) }>
            <{* dump var=$navIdxArr *}>
            <{foreach from=$navIdxArr item=value key=key}>
                <{if $value == 0 || $value == 4}>
                <{/if}>
                        <div class="set-item">
                            <div class="goods-pic">
                                <span class="des">导航图片:</span>
                                <{input type="image" name="wxapps[{$value}][thumLogo]" value=$wxapps.$value.thumLogo}>
                                <p>建议尺寸<br>100px*100px</p>
                            </div>
                            <div class="select-cont">
                                <div class="sel wxapps-sel">
                                    <label>选择类别：</label>
                                    <select name="wxapps[<{$value}>][type]" onchange="pullTarget(this,'<{$value}>')">
                                        <option value="cat" <{if $wxapps.$value.type == 'cat'}>selected<{/if}>>分类</option>
                                        <option value="tag" <{if $wxapps.$value.type == 'tag'}>selected<{/if}>>标签</option>
                                    </select>
                                </div>
                                <div class="sel wxapps-cat" id="wxapps-cat-<{$value}>" style="<{if $wxapps.$value.type == 'tag'}>display: none;<{/if}>">
                                    <label>分类:</label> <select name="wxapps[<{$value}>][code]">
                                    <{foreach from=$catList item=cat key=key}>
                                        <option value="<{$cat.cat_id}>" <{if $wxapps.$value.code == $cat.cat_id }>selected<{/if}> ><{$cat.cat_name}></option>
                                    <{/foreach}>
                                    </select>
                                </div>
                                <div class="sel wxapps-tag" id="wxapps-tag-<{$value}>" style="<{if $wxapps.$value.type == 'cat'}>display: none;<{/if}>">
                                    <label>标签：</label> <select name="wxapps[<{$value}>][code]">
                                    <{foreach from=$tagList item=tag key=key}>
                                        <option value="<{$tag.tag_id}>" <{if $wxapps.$value.code == $tag.tag_id}>selected<{/if}> ><{$tag.tag_name}></option>
                                    <{/foreach}>
                                    </select>
                                </div>
                            </div>
                            <div class="goods-des">
                                <label>导航名称：</label><input type="text" name="wxapps[<{$value}>][name]" value="<{$wxapps[$value]['name']}>" >
                            </div>
                        </div>
                <{if $value == 3 || $value == 7}>
                <{/if}>
            <{/foreach}>
       </div>
</form>

<div class="table-action">
    <{button type="button" class="btn-primary" label=$___b2c="保存"|t:'b2c' id="member_lv-form-submit"}>
</div>


<script>
    (function(){
        var _form = $('form_member_lv');
        var btn =$('member_lv-form-submit');
        var finder = finderGroup['<{$env.get._finder.finder_id}>'];
        _form.store('target',{
            onSuccess:function(response){
                var hash_res_obj = JSON.decode(response);

            }
        });

        btn.addEvent('click',function(){
            _form.fireEvent('submit',{stop:$empty});
        });

    })();

    function pullTarget(el,id) {
        var _type = $$(el).getValue();
        if(_type == 'cat') {
            $('wxapps-cat-'+id).show();
            $('wxapps-tag-'+id).hide();
        }else{
            $('wxapps-tag-'+id).show();
            $('wxapps-cat-'+id).hide();
        }
    }
</script>